H-Segment dot led is Enable Table. (Common anode configuration)
H-Segment dot led is Disable Table. (Common anode configuration)
H-Segment dot led is Enable Table. (Common cathode configuration)
H-Segment dot led is Disable Table. (Common cathode configuration)
Applications:
/* Name : main.c * Purpose : Source code for 7SEG-COMMON-ANODE Interfacing with AT89C52. * Author : Gemicates * Date : 2014-01-13 * Website : www.gemicates.org * Revision : None */ #include <REGX52.H> // header file for AT89c52 series #define seg_port P2 // GPIO direction register declaration void delay(int msec) //delay function declaration { int i,j; for(i=0;i<msec;i++) for(j=0;j<1275;j++); } void main() //main function { seg_port = 0xFF; //Port 2 make as aoutput port while(1) { seg_port = 0xFE; // 'A' segment turn on delay(50); seg_port = 0xFD; // 'B' segment turn on delay(50); seg_port = 0xFB; // 'C' segment turn on delay(50); seg_port = 0xF7; // 'D' segment turn on delay(50); seg_port = 0xEF; // 'E' segment turn on delay(50); seg_port = 0xDF; // 'F' segment turn on delay(50); seg_port = 0xBF; // 'G' segment turn on delay(50); seg_port = 0x7F; // 'H' segment turn on delay(50); // Default 'H' segment turn OFF seg_port = 0x40; // Display '0' delay(50); seg_port = 0x79; // Display '1' delay(50); seg_port = 0x24; // Display '2' delay(50); seg_port = 0x30; // Display '3' delay(50); seg_port = 0x19; // Display '4' delay(50); seg_port = 0x12; // Display '5' delay(50); seg_port = 0x02; // Display '6' delay(50); seg_port = 0x78; // Display '7' delay(50); seg_port = 0x00; // Display '8' delay(50); seg_port = 0x10; // Display '9' delay(50); // Default 'H' segment turn ON seg_port = 0xC0; // Display '0' delay(50); seg_port = 0xF9; // Display '1' delay(50); seg_port = 0xA4; // Display '2' delay(50); seg_port = 0xB0; // Display '3' delay(50); seg_port = 0x99; // Display '4' delay(50); seg_port = 0x92; // Display '5' delay(50); seg_port = 0x82; // Display '6' delay(50); seg_port = 0xF8; // Display '7' delay(50); seg_port = 0x80; // Display '8' delay(50); seg_port = 0x90; // Display '9' delay(50); } }